<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-pragma">{-# LANGUAGE CPP #-}</span><span class="hs-cpp">
#if __GLASGOW_HASKELL__ &gt;= 702
</span><span class="hs-pragma">{-# LANGUAGE Safe #-}</span><span class="hs-cpp">
#endif
</span><span class="hs-cpp">#if __GLASGOW_HASKELL__ &gt;= 710
</span><span class="hs-pragma">{-# LANGUAGE AutoDeriveTypeable #-}</span><span class="hs-cpp">
#endif
</span><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
</span><span id="line-9"></span><span class="hs-comment">-- |</span><span>
</span><span id="line-10"></span><span class="hs-comment">-- Module      :  Control.Monad.Trans.Writer.CPS</span><span>
</span><span id="line-11"></span><span class="hs-comment">-- Copyright   :  (c) Daniel Mendler 2016,</span><span>
</span><span id="line-12"></span><span class="hs-comment">--                (c) Andy Gill 2001,</span><span>
</span><span id="line-13"></span><span class="hs-comment">--                (c) Oregon Graduate Institute of Science and Technology, 2001</span><span>
</span><span id="line-14"></span><span class="hs-comment">-- License     :  BSD-style (see the file LICENSE)</span><span>
</span><span id="line-15"></span><span class="hs-comment">--</span><span>
</span><span id="line-16"></span><span class="hs-comment">-- Maintainer  :  R.Paterson@city.ac.uk</span><span>
</span><span id="line-17"></span><span class="hs-comment">-- Stability   :  experimental</span><span>
</span><span id="line-18"></span><span class="hs-comment">-- Portability :  portable</span><span>
</span><span id="line-19"></span><span class="hs-comment">--</span><span>
</span><span id="line-20"></span><span class="hs-comment">-- The strict 'WriterT' monad transformer, which adds collection of</span><span>
</span><span id="line-21"></span><span class="hs-comment">-- outputs (such as a count or string output) to a given monad.</span><span>
</span><span id="line-22"></span><span class="hs-comment">--</span><span>
</span><span id="line-23"></span><span class="hs-comment">-- This monad transformer provides only limited access to the output</span><span>
</span><span id="line-24"></span><span class="hs-comment">-- during the computation. For more general access, use</span><span>
</span><span id="line-25"></span><span class="hs-comment">-- &quot;Control.Monad.Trans.State&quot; instead.</span><span>
</span><span id="line-26"></span><span class="hs-comment">--</span><span>
</span><span id="line-27"></span><span class="hs-comment">-- This version builds its output strictly and uses continuation-passing-style</span><span>
</span><span id="line-28"></span><span class="hs-comment">-- to achieve constant space usage. This transformer can be used as a</span><span>
</span><span id="line-29"></span><span class="hs-comment">-- drop-in replacement for &quot;Control.Monad.Trans.Writer.Strict&quot;.</span><span>
</span><span id="line-30"></span><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
</span><span id="line-31"></span><span>
</span><span id="line-32"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">Control.Monad.Trans.Writer.CPS</span><span> </span><span class="hs-special">(</span><span>
</span><span id="line-33"></span><span>    </span><span class="annot"><span class="hs-comment">-- * The Writer monad</span></span><span>
</span><span id="line-34"></span><span>    </span><span class="annot"><a href="Control.Monad.Trans.Writer.CPS.html#Writer"><span class="hs-identifier">Writer</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-35"></span><span>    </span><span class="annot"><a href="Control.Monad.Trans.Writer.CPS.html#writer"><span class="hs-identifier">writer</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-36"></span><span>    </span><span class="annot"><a href="Control.Monad.Trans.Writer.CPS.html#runWriter"><span class="hs-identifier">runWriter</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-37"></span><span>    </span><span class="annot"><a href="Control.Monad.Trans.Writer.CPS.html#execWriter"><span class="hs-identifier">execWriter</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-38"></span><span>    </span><span class="annot"><a href="Control.Monad.Trans.Writer.CPS.html#mapWriter"><span class="hs-identifier">mapWriter</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-39"></span><span>    </span><span class="annot"><span class="hs-comment">-- * The WriterT monad transformer</span></span><span>
</span><span id="line-40"></span><span>    </span><span class="annot"><a href="Control.Monad.Trans.Writer.CPS.html#WriterT"><span class="hs-identifier">WriterT</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-41"></span><span>    </span><span class="annot"><a href="Control.Monad.Trans.Writer.CPS.html#writerT"><span class="hs-identifier">writerT</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-42"></span><span>    </span><span class="annot"><a href="Control.Monad.Trans.Writer.CPS.html#runWriterT"><span class="hs-identifier">runWriterT</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-43"></span><span>    </span><span class="annot"><a href="Control.Monad.Trans.Writer.CPS.html#execWriterT"><span class="hs-identifier">execWriterT</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-44"></span><span>    </span><span class="annot"><a href="Control.Monad.Trans.Writer.CPS.html#mapWriterT"><span class="hs-identifier">mapWriterT</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-45"></span><span>    </span><span class="annot"><span class="hs-comment">-- * Writer operations</span></span><span>
</span><span id="line-46"></span><span>    </span><span class="annot"><a href="Control.Monad.Trans.Writer.CPS.html#tell"><span class="hs-identifier">tell</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-47"></span><span>    </span><span class="annot"><a href="Control.Monad.Trans.Writer.CPS.html#listen"><span class="hs-identifier">listen</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-48"></span><span>    </span><span class="annot"><a href="Control.Monad.Trans.Writer.CPS.html#listens"><span class="hs-identifier">listens</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-49"></span><span>    </span><span class="annot"><a href="Control.Monad.Trans.Writer.CPS.html#pass"><span class="hs-identifier">pass</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-50"></span><span>    </span><span class="annot"><a href="Control.Monad.Trans.Writer.CPS.html#censor"><span class="hs-identifier">censor</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-51"></span><span>    </span><span class="annot"><span class="hs-comment">-- * Lifting other operations</span></span><span>
</span><span id="line-52"></span><span>    </span><span class="annot"><a href="Control.Monad.Trans.Writer.CPS.html#liftCallCC"><span class="hs-identifier">liftCallCC</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-53"></span><span>    </span><span class="annot"><a href="Control.Monad.Trans.Writer.CPS.html#liftCatch"><span class="hs-identifier">liftCatch</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-54"></span><span>  </span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-55"></span><span>
</span><span id="line-56"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Control.Applicative.html#"><span class="hs-identifier">Control.Applicative</span></a></span><span>
</span><span id="line-57"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Control.Monad.html#"><span class="hs-identifier">Control.Monad</span></a></span><span>
</span><span id="line-58"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Control.Monad.Fix.html#"><span class="hs-identifier">Control.Monad.Fix</span></a></span><span>
</span><span id="line-59"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Control.Monad.IO.Class.html#"><span class="hs-identifier">Control.Monad.IO.Class</span></a></span><span>
</span><span id="line-60"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Class.html"><span class="hs-identifier">Control.Monad.Trans.Class</span></a></span><span>
</span><span id="line-61"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Control.Monad.Signatures.html"><span class="hs-identifier">Control.Monad.Signatures</span></a></span><span>
</span><span id="line-62"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.Functor.Identity.html#"><span class="hs-identifier">Data.Functor.Identity</span></a></span><span class="hs-cpp">

#if !(MIN_VERSION_base(4,8,0))
</span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Data.Monoid</span><span class="hs-cpp">
#endif
</span><span class="hs-cpp">
#if MIN_VERSION_base(4,9,0)
</span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><a href="../../base/src/Control.Monad.Fail.html#"><span class="hs-identifier">Control.Monad.Fail</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">Fail</span></span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-72"></span><span class="hs-comment">-- ---------------------------------------------------------------------------</span><span>
</span><span id="line-73"></span><span class="hs-comment">-- | A writer monad parameterized by the type @w@ of output to accumulate.</span><span>
</span><span id="line-74"></span><span class="hs-comment">--</span><span>
</span><span id="line-75"></span><span class="hs-comment">-- The 'return' function produces the output 'mempty', while '&gt;&gt;='</span><span>
</span><span id="line-76"></span><span class="hs-comment">-- combines the outputs of the subcomputations using 'mappend'.</span><span>
</span><span id="line-77"></span><span class="hs-keyword">type</span><span> </span><span id="Writer"><span class="annot"><a href="Control.Monad.Trans.Writer.CPS.html#Writer"><span class="hs-identifier hs-var">Writer</span></a></span></span><span> </span><span id="local-6989586621679082299"><span class="annot"><a href="#local-6989586621679082299"><span class="hs-identifier hs-type">w</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Writer.CPS.html#WriterT"><span class="hs-identifier hs-type">WriterT</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082299"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="../../base/src/Data.Functor.Identity.html#Identity"><span class="hs-identifier hs-type">Identity</span></a></span><span>
</span><span id="line-78"></span><span>
</span><span id="line-79"></span><span class="hs-comment">-- | Construct a writer computation from a (result, output) pair.</span><span>
</span><span id="line-80"></span><span class="hs-comment">-- (The inverse of 'runWriter'.)</span><span>
</span><span id="line-81"></span><span id="local-6989586621679082546"><span id="local-6989586621679082547"><span id="local-6989586621679082548"><span class="annot"><a href="Control.Monad.Trans.Writer.CPS.html#writer"><span class="hs-identifier hs-type">writer</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#Monoid"><span class="hs-identifier hs-type">Monoid</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082548"><span class="hs-identifier hs-type">w</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#Monad"><span class="hs-identifier hs-type">Monad</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082547"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679082546"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621679082548"><span class="hs-identifier hs-type">w</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Writer.CPS.html#WriterT"><span class="hs-identifier hs-type">WriterT</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082548"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082547"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082546"><span class="hs-identifier hs-type">a</span></a></span></span></span></span><span>
</span><span id="line-82"></span><span id="writer"><span class="annot"><span class="annottext">writer :: forall w (m :: * -&gt; *) a.
(Monoid w, Monad m) =&gt;
(a, w) -&gt; WriterT w m a
</span><a href="Control.Monad.Trans.Writer.CPS.html#writer"><span class="hs-identifier hs-var hs-var">writer</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679082295"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679082295"><span class="hs-identifier hs-var">a</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679082294"><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679082294"><span class="hs-identifier hs-var">w'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(w -&gt; m (a, w)) -&gt; WriterT w m a
forall w (m :: * -&gt; *) a. (w -&gt; m (a, w)) -&gt; WriterT w m a
</span><a href="Control.Monad.Trans.Writer.CPS.html#WriterT"><span class="hs-identifier hs-var">WriterT</span></a></span><span> </span><span class="annot"><span class="annottext">((w -&gt; m (a, w)) -&gt; WriterT w m a)
-&gt; (w -&gt; m (a, w)) -&gt; WriterT w m a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621679082292"><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679082292"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-83"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621679082290"><span class="annot"><span class="annottext">wt :: w
</span><a href="#local-6989586621679082290"><span class="hs-identifier hs-var hs-var">wt</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679082292"><span class="hs-identifier hs-var">w</span></a></span><span> </span><span class="annot"><span class="annottext">w -&gt; w -&gt; w
forall a. Monoid a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Base.html#mappend"><span class="hs-operator hs-var">`mappend`</span></a></span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679082294"><span class="hs-identifier hs-var">w'</span></a></span><span> </span><span class="hs-keyword">in</span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679082290"><span class="hs-identifier hs-var">wt</span></a></span><span> </span><span class="annot"><span class="annottext">w -&gt; m (a, w) -&gt; m (a, w)
</span><span class="hs-operator hs-var">`seq`</span></span><span> </span><span class="annot"><span class="annottext">(a, w) -&gt; m (a, w)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679082295"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679082290"><span class="hs-identifier hs-var">wt</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-84"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Writer.CPS.html#writer"><span class="hs-pragma hs-type">writer</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-85"></span><span>
</span><span id="line-86"></span><span class="hs-comment">-- | Unwrap a writer computation as a (result, output) pair.</span><span>
</span><span id="line-87"></span><span class="hs-comment">-- (The inverse of 'writer'.)</span><span>
</span><span id="line-88"></span><span id="local-6989586621679082529"><span id="local-6989586621679082530"><span class="annot"><a href="Control.Monad.Trans.Writer.CPS.html#runWriter"><span class="hs-identifier hs-type">runWriter</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#Monoid"><span class="hs-identifier hs-type">Monoid</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082530"><span class="hs-identifier hs-type">w</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Writer.CPS.html#Writer"><span class="hs-identifier hs-type">Writer</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082530"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082529"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679082529"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621679082530"><span class="hs-identifier hs-type">w</span></a></span><span class="hs-special">)</span></span></span><span>
</span><span id="line-89"></span><span id="runWriter"><span class="annot"><span class="annottext">runWriter :: forall w a. Monoid w =&gt; Writer w a -&gt; (a, w)
</span><a href="Control.Monad.Trans.Writer.CPS.html#runWriter"><span class="hs-identifier hs-var hs-var">runWriter</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Identity (a, w) -&gt; (a, w)
forall a. Identity a -&gt; a
</span><a href="../../base/src/Data.Functor.Identity.html#runIdentity"><span class="hs-identifier hs-var hs-var">runIdentity</span></a></span><span> </span><span class="annot"><span class="annottext">(Identity (a, w) -&gt; (a, w))
-&gt; (WriterT w Identity a -&gt; Identity (a, w))
-&gt; WriterT w Identity a
-&gt; (a, w)
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">WriterT w Identity a -&gt; Identity (a, w)
forall w (m :: * -&gt; *) a. Monoid w =&gt; WriterT w m a -&gt; m (a, w)
</span><a href="Control.Monad.Trans.Writer.CPS.html#runWriterT"><span class="hs-identifier hs-var">runWriterT</span></a></span><span>
</span><span id="line-90"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Writer.CPS.html#runWriter"><span class="hs-pragma hs-type">runWriter</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-91"></span><span>
</span><span id="line-92"></span><span class="hs-comment">-- | Extract the output from a writer computation.</span><span>
</span><span id="line-93"></span><span class="hs-comment">--</span><span>
</span><span id="line-94"></span><span class="hs-comment">-- * @'execWriter' m = 'snd' ('runWriter' m)@</span><span>
</span><span id="line-95"></span><span id="local-6989586621679082516"><span id="local-6989586621679082517"><span class="annot"><a href="Control.Monad.Trans.Writer.CPS.html#execWriter"><span class="hs-identifier hs-type">execWriter</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#Monoid"><span class="hs-identifier hs-type">Monoid</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082517"><span class="hs-identifier hs-type">w</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Writer.CPS.html#Writer"><span class="hs-identifier hs-type">Writer</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082517"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082516"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679082517"><span class="hs-identifier hs-type">w</span></a></span></span></span><span>
</span><span id="line-96"></span><span id="execWriter"><span class="annot"><span class="annottext">execWriter :: forall w a. Monoid w =&gt; Writer w a -&gt; w
</span><a href="Control.Monad.Trans.Writer.CPS.html#execWriter"><span class="hs-identifier hs-var hs-var">execWriter</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Identity w -&gt; w
forall a. Identity a -&gt; a
</span><a href="../../base/src/Data.Functor.Identity.html#runIdentity"><span class="hs-identifier hs-var hs-var">runIdentity</span></a></span><span> </span><span class="annot"><span class="annottext">(Identity w -&gt; w)
-&gt; (WriterT w Identity a -&gt; Identity w)
-&gt; WriterT w Identity a
-&gt; w
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">WriterT w Identity a -&gt; Identity w
forall (m :: * -&gt; *) w a.
(Monad m, Monoid w) =&gt;
WriterT w m a -&gt; m w
</span><a href="Control.Monad.Trans.Writer.CPS.html#execWriterT"><span class="hs-identifier hs-var">execWriterT</span></a></span><span>
</span><span id="line-97"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Writer.CPS.html#execWriter"><span class="hs-pragma hs-type">execWriter</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-98"></span><span>
</span><span id="line-99"></span><span class="hs-comment">-- | Map both the return value and output of a computation using</span><span>
</span><span id="line-100"></span><span class="hs-comment">-- the given function.</span><span>
</span><span id="line-101"></span><span class="hs-comment">--</span><span>
</span><span id="line-102"></span><span class="hs-comment">-- * @'runWriter' ('mapWriter' f m) = f ('runWriter' m)@</span><span>
</span><span id="line-103"></span><span id="local-6989586621679082507"><span id="local-6989586621679082508"><span id="local-6989586621679082509"><span id="local-6989586621679082510"><span class="annot"><a href="Control.Monad.Trans.Writer.CPS.html#mapWriter"><span class="hs-identifier hs-type">mapWriter</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#Monoid"><span class="hs-identifier hs-type">Monoid</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082510"><span class="hs-identifier hs-type">w</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#Monoid"><span class="hs-identifier hs-type">Monoid</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082509"><span class="hs-identifier hs-type">w'</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span>
</span><span id="line-104"></span><span>    </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679082508"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621679082510"><span class="hs-identifier hs-type">w</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679082507"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621679082509"><span class="hs-identifier hs-type">w'</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Writer.CPS.html#Writer"><span class="hs-identifier hs-type">Writer</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082510"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082508"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Writer.CPS.html#Writer"><span class="hs-identifier hs-type">Writer</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082509"><span class="hs-identifier hs-type">w'</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082507"><span class="hs-identifier hs-type">b</span></a></span></span></span></span></span><span>
</span><span id="line-105"></span><span id="mapWriter"><span class="annot"><span class="annottext">mapWriter :: forall w w' a b.
(Monoid w, Monoid w') =&gt;
((a, w) -&gt; (b, w')) -&gt; Writer w a -&gt; Writer w' b
</span><a href="Control.Monad.Trans.Writer.CPS.html#mapWriter"><span class="hs-identifier hs-var hs-var">mapWriter</span></a></span></span><span> </span><span id="local-6989586621679082276"><span class="annot"><span class="annottext">(a, w) -&gt; (b, w')
</span><a href="#local-6989586621679082276"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Identity (a, w) -&gt; Identity (b, w'))
-&gt; WriterT w Identity a -&gt; WriterT w' Identity b
forall (n :: * -&gt; *) w w' (m :: * -&gt; *) a b.
(Monad n, Monoid w, Monoid w') =&gt;
(m (a, w) -&gt; n (b, w')) -&gt; WriterT w m a -&gt; WriterT w' n b
</span><a href="Control.Monad.Trans.Writer.CPS.html#mapWriterT"><span class="hs-identifier hs-var">mapWriterT</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(b, w') -&gt; Identity (b, w')
forall a. a -&gt; Identity a
</span><a href="../../base/src/Data.Functor.Identity.html#Identity"><span class="hs-identifier hs-var">Identity</span></a></span><span> </span><span class="annot"><span class="annottext">((b, w') -&gt; Identity (b, w'))
-&gt; (Identity (a, w) -&gt; (b, w'))
-&gt; Identity (a, w)
-&gt; Identity (b, w')
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">(a, w) -&gt; (b, w')
</span><a href="#local-6989586621679082276"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">((a, w) -&gt; (b, w'))
-&gt; (Identity (a, w) -&gt; (a, w)) -&gt; Identity (a, w) -&gt; (b, w')
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Identity (a, w) -&gt; (a, w)
forall a. Identity a -&gt; a
</span><a href="../../base/src/Data.Functor.Identity.html#runIdentity"><span class="hs-identifier hs-var hs-var">runIdentity</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-106"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Writer.CPS.html#mapWriter"><span class="hs-pragma hs-type">mapWriter</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-107"></span><span>
</span><span id="line-108"></span><span class="hs-comment">-- ---------------------------------------------------------------------------</span><span>
</span><span id="line-109"></span><span class="hs-comment">-- | A writer monad parameterized by:</span><span>
</span><span id="line-110"></span><span class="hs-comment">--</span><span>
</span><span id="line-111"></span><span class="hs-comment">--   * @w@ - the output to accumulate.</span><span>
</span><span id="line-112"></span><span class="hs-comment">--</span><span>
</span><span id="line-113"></span><span class="hs-comment">--   * @m@ - The inner monad.</span><span>
</span><span id="line-114"></span><span class="hs-comment">--</span><span>
</span><span id="line-115"></span><span class="hs-comment">-- The 'return' function produces the output 'mempty', while '&gt;&gt;='</span><span>
</span><span id="line-116"></span><span class="hs-comment">-- combines the outputs of the subcomputations using 'mappend'.</span><span>
</span><span id="line-117"></span><span>
</span><span id="line-118"></span><span class="hs-keyword">newtype</span><span> </span><span id="WriterT"><span class="annot"><a href="Control.Monad.Trans.Writer.CPS.html#WriterT"><span class="hs-identifier hs-var">WriterT</span></a></span></span><span> </span><span id="local-6989586621679082542"><span class="annot"><a href="#local-6989586621679082542"><span class="hs-identifier hs-type">w</span></a></span></span><span> </span><span id="local-6989586621679082541"><span class="annot"><a href="#local-6989586621679082541"><span class="hs-identifier hs-type">m</span></a></span></span><span> </span><span id="local-6989586621679082540"><span class="annot"><a href="#local-6989586621679082540"><span class="hs-identifier hs-type">a</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="WriterT"><span class="annot"><a href="Control.Monad.Trans.Writer.CPS.html#WriterT"><span class="hs-identifier hs-var">WriterT</span></a></span></span><span> </span><span class="hs-special">{</span><span> </span><span id="unWriterT"><span class="annot"><span class="annottext">forall w (m :: * -&gt; *) a. WriterT w m a -&gt; w -&gt; m (a, w)
</span><a href="Control.Monad.Trans.Writer.CPS.html#unWriterT"><span class="hs-identifier hs-var hs-var">unWriterT</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621679082542"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679082541"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679082540"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621679082542"><span class="hs-identifier hs-type">w</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-119"></span><span>
</span><span id="line-120"></span><span class="hs-comment">-- | Construct a writer computation from a (result, output) computation.</span><span>
</span><span id="line-121"></span><span class="hs-comment">-- (The inverse of 'runWriterT'.)</span><span>
</span><span id="line-122"></span><span id="local-6989586621679082490"><span id="local-6989586621679082491"><span id="local-6989586621679082492"><span class="annot"><a href="Control.Monad.Trans.Writer.CPS.html#writerT"><span class="hs-identifier hs-type">writerT</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#Functor"><span class="hs-identifier hs-type">Functor</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082492"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#Monoid"><span class="hs-identifier hs-type">Monoid</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082491"><span class="hs-identifier hs-type">w</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679082492"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679082490"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621679082491"><span class="hs-identifier hs-type">w</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Writer.CPS.html#WriterT"><span class="hs-identifier hs-type">WriterT</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082491"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082492"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082490"><span class="hs-identifier hs-type">a</span></a></span></span></span></span><span>
</span><span id="line-123"></span><span id="writerT"><span class="annot"><span class="annottext">writerT :: forall (m :: * -&gt; *) w a.
(Functor m, Monoid w) =&gt;
m (a, w) -&gt; WriterT w m a
</span><a href="Control.Monad.Trans.Writer.CPS.html#writerT"><span class="hs-identifier hs-var hs-var">writerT</span></a></span></span><span> </span><span id="local-6989586621679082270"><span class="annot"><span class="annottext">m (a, w)
</span><a href="#local-6989586621679082270"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(w -&gt; m (a, w)) -&gt; WriterT w m a
forall w (m :: * -&gt; *) a. (w -&gt; m (a, w)) -&gt; WriterT w m a
</span><a href="Control.Monad.Trans.Writer.CPS.html#WriterT"><span class="hs-identifier hs-var">WriterT</span></a></span><span> </span><span class="annot"><span class="annottext">((w -&gt; m (a, w)) -&gt; WriterT w m a)
-&gt; (w -&gt; m (a, w)) -&gt; WriterT w m a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621679082269"><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679082269"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-124"></span><span>    </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span> </span><span class="hs-special">(</span><span id="local-6989586621679082268"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679082268"><span class="hs-identifier hs-var">a</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679082267"><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679082267"><span class="hs-identifier hs-var">w'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621679082265"><span class="annot"><span class="annottext">wt :: w
</span><a href="#local-6989586621679082265"><span class="hs-identifier hs-var hs-var">wt</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679082269"><span class="hs-identifier hs-var">w</span></a></span><span> </span><span class="annot"><span class="annottext">w -&gt; w -&gt; w
forall a. Monoid a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Base.html#mappend"><span class="hs-operator hs-var">`mappend`</span></a></span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679082267"><span class="hs-identifier hs-var">w'</span></a></span><span> </span><span class="hs-keyword">in</span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679082265"><span class="hs-identifier hs-var">wt</span></a></span><span> </span><span class="annot"><span class="annottext">w -&gt; (a, w) -&gt; (a, w)
</span><span class="hs-operator hs-var">`seq`</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679082268"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679082265"><span class="hs-identifier hs-var">wt</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">((a, w) -&gt; (a, w)) -&gt; m (a, w) -&gt; m (a, w)
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/Data.Functor.html#%3C%24%3E"><span class="hs-operator hs-var">&lt;$&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">m (a, w)
</span><a href="#local-6989586621679082270"><span class="hs-identifier hs-var">f</span></a></span><span>
</span><span id="line-125"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Writer.CPS.html#writerT"><span class="hs-pragma hs-type">writerT</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-126"></span><span>
</span><span id="line-127"></span><span class="hs-comment">-- | Unwrap a writer computation.</span><span>
</span><span id="line-128"></span><span class="hs-comment">-- (The inverse of 'writerT'.)</span><span>
</span><span id="line-129"></span><span id="local-6989586621679082518"><span id="local-6989586621679082519"><span id="local-6989586621679082520"><span class="annot"><a href="Control.Monad.Trans.Writer.CPS.html#runWriterT"><span class="hs-identifier hs-type">runWriterT</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#Monoid"><span class="hs-identifier hs-type">Monoid</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082520"><span class="hs-identifier hs-type">w</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Writer.CPS.html#WriterT"><span class="hs-identifier hs-type">WriterT</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082520"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082519"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082518"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679082519"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679082518"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621679082520"><span class="hs-identifier hs-type">w</span></a></span><span class="hs-special">)</span></span></span></span><span>
</span><span id="line-130"></span><span id="runWriterT"><span class="annot"><span class="annottext">runWriterT :: forall w (m :: * -&gt; *) a. Monoid w =&gt; WriterT w m a -&gt; m (a, w)
</span><a href="Control.Monad.Trans.Writer.CPS.html#runWriterT"><span class="hs-identifier hs-var hs-var">runWriterT</span></a></span></span><span> </span><span id="local-6989586621679082261"><span class="annot"><span class="annottext">WriterT w m a
</span><a href="#local-6989586621679082261"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">WriterT w m a -&gt; w -&gt; m (a, w)
forall w (m :: * -&gt; *) a. WriterT w m a -&gt; w -&gt; m (a, w)
</span><a href="Control.Monad.Trans.Writer.CPS.html#unWriterT"><span class="hs-identifier hs-var hs-var">unWriterT</span></a></span><span> </span><span class="annot"><span class="annottext">WriterT w m a
</span><a href="#local-6989586621679082261"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">w
forall a. Monoid a =&gt; a
</span><a href="../../base/src/GHC.Base.html#mempty"><span class="hs-identifier hs-var">mempty</span></a></span><span>
</span><span id="line-131"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Writer.CPS.html#runWriterT"><span class="hs-pragma hs-type">runWriterT</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-132"></span><span>
</span><span id="line-133"></span><span class="hs-comment">-- | Extract the output from a writer computation.</span><span>
</span><span id="line-134"></span><span class="hs-comment">--</span><span>
</span><span id="line-135"></span><span class="hs-comment">-- * @'execWriterT' m = 'liftM' 'snd' ('runWriterT' m)@</span><span>
</span><span id="line-136"></span><span id="local-6989586621679082511"><span id="local-6989586621679082512"><span id="local-6989586621679082513"><span class="annot"><a href="Control.Monad.Trans.Writer.CPS.html#execWriterT"><span class="hs-identifier hs-type">execWriterT</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#Monad"><span class="hs-identifier hs-type">Monad</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082513"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#Monoid"><span class="hs-identifier hs-type">Monoid</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082512"><span class="hs-identifier hs-type">w</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Writer.CPS.html#WriterT"><span class="hs-identifier hs-type">WriterT</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082512"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082513"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082511"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679082513"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082512"><span class="hs-identifier hs-type">w</span></a></span></span></span></span><span>
</span><span id="line-137"></span><span id="execWriterT"><span class="annot"><span class="annottext">execWriterT :: forall (m :: * -&gt; *) w a.
(Monad m, Monoid w) =&gt;
WriterT w m a -&gt; m w
</span><a href="Control.Monad.Trans.Writer.CPS.html#execWriterT"><span class="hs-identifier hs-var hs-var">execWriterT</span></a></span></span><span> </span><span id="local-6989586621679082255"><span class="annot"><span class="annottext">WriterT w m a
</span><a href="#local-6989586621679082255"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-138"></span><span>    </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679082254"><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679082254"><span class="hs-identifier hs-var">w</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">WriterT w m a -&gt; m (a, w)
forall w (m :: * -&gt; *) a. Monoid w =&gt; WriterT w m a -&gt; m (a, w)
</span><a href="Control.Monad.Trans.Writer.CPS.html#runWriterT"><span class="hs-identifier hs-var">runWriterT</span></a></span><span> </span><span class="annot"><span class="annottext">WriterT w m a
</span><a href="#local-6989586621679082255"><span class="hs-identifier hs-var">m</span></a></span><span>
</span><span id="line-139"></span><span>    </span><span class="annot"><span class="annottext">w -&gt; m w
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679082254"><span class="hs-identifier hs-var">w</span></a></span><span>
</span><span id="line-140"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Writer.CPS.html#execWriterT"><span class="hs-pragma hs-type">execWriterT</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-141"></span><span>
</span><span id="line-142"></span><span class="hs-comment">-- | Map both the return value and output of a computation using</span><span>
</span><span id="line-143"></span><span class="hs-comment">-- the given function.</span><span>
</span><span id="line-144"></span><span class="hs-comment">--</span><span>
</span><span id="line-145"></span><span class="hs-comment">-- * @'runWriterT' ('mapWriterT' f m) = f ('runWriterT' m)@</span><span>
</span><span id="line-146"></span><span id="local-6989586621679082497"><span id="local-6989586621679082498"><span id="local-6989586621679082499"><span id="local-6989586621679082500"><span id="local-6989586621679082501"><span id="local-6989586621679082502"><span class="annot"><a href="Control.Monad.Trans.Writer.CPS.html#mapWriterT"><span class="hs-identifier hs-type">mapWriterT</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#Monad"><span class="hs-identifier hs-type">Monad</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082502"><span class="hs-identifier hs-type">n</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#Monoid"><span class="hs-identifier hs-type">Monoid</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082501"><span class="hs-identifier hs-type">w</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#Monoid"><span class="hs-identifier hs-type">Monoid</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082500"><span class="hs-identifier hs-type">w'</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span>
</span><span id="line-147"></span><span>    </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679082499"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679082498"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621679082501"><span class="hs-identifier hs-type">w</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679082502"><span class="hs-identifier hs-type">n</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679082497"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621679082500"><span class="hs-identifier hs-type">w'</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Writer.CPS.html#WriterT"><span class="hs-identifier hs-type">WriterT</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082501"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082499"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082498"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Writer.CPS.html#WriterT"><span class="hs-identifier hs-type">WriterT</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082500"><span class="hs-identifier hs-type">w'</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082502"><span class="hs-identifier hs-type">n</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082497"><span class="hs-identifier hs-type">b</span></a></span></span></span></span></span></span></span><span>
</span><span id="line-148"></span><span id="mapWriterT"><span class="annot"><span class="annottext">mapWriterT :: forall (n :: * -&gt; *) w w' (m :: * -&gt; *) a b.
(Monad n, Monoid w, Monoid w') =&gt;
(m (a, w) -&gt; n (b, w')) -&gt; WriterT w m a -&gt; WriterT w' n b
</span><a href="Control.Monad.Trans.Writer.CPS.html#mapWriterT"><span class="hs-identifier hs-var hs-var">mapWriterT</span></a></span></span><span> </span><span id="local-6989586621679082247"><span class="annot"><span class="annottext">m (a, w) -&gt; n (b, w')
</span><a href="#local-6989586621679082247"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679082246"><span class="annot"><span class="annottext">WriterT w m a
</span><a href="#local-6989586621679082246"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(w' -&gt; n (b, w')) -&gt; WriterT w' n b
forall w (m :: * -&gt; *) a. (w -&gt; m (a, w)) -&gt; WriterT w m a
</span><a href="Control.Monad.Trans.Writer.CPS.html#WriterT"><span class="hs-identifier hs-var">WriterT</span></a></span><span> </span><span class="annot"><span class="annottext">((w' -&gt; n (b, w')) -&gt; WriterT w' n b)
-&gt; (w' -&gt; n (b, w')) -&gt; WriterT w' n b
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621679082245"><span class="annot"><span class="annottext">w'
</span><a href="#local-6989586621679082245"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-149"></span><span>    </span><span class="hs-special">(</span><span id="local-6989586621679082244"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679082244"><span class="hs-identifier hs-var">a</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679082243"><span class="annot"><span class="annottext">w'
</span><a href="#local-6989586621679082243"><span class="hs-identifier hs-var">w'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">m (a, w) -&gt; n (b, w')
</span><a href="#local-6989586621679082247"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">WriterT w m a -&gt; m (a, w)
forall w (m :: * -&gt; *) a. Monoid w =&gt; WriterT w m a -&gt; m (a, w)
</span><a href="Control.Monad.Trans.Writer.CPS.html#runWriterT"><span class="hs-identifier hs-var">runWriterT</span></a></span><span> </span><span class="annot"><span class="annottext">WriterT w m a
</span><a href="#local-6989586621679082246"><span class="hs-identifier hs-var">m</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-150"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621679082241"><span class="annot"><span class="annottext">wt :: w'
</span><a href="#local-6989586621679082241"><span class="hs-identifier hs-var hs-var">wt</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">w'
</span><a href="#local-6989586621679082245"><span class="hs-identifier hs-var">w</span></a></span><span> </span><span class="annot"><span class="annottext">w' -&gt; w' -&gt; w'
forall a. Monoid a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Base.html#mappend"><span class="hs-operator hs-var">`mappend`</span></a></span><span> </span><span class="annot"><span class="annottext">w'
</span><a href="#local-6989586621679082243"><span class="hs-identifier hs-var">w'</span></a></span><span>
</span><span id="line-151"></span><span>    </span><span class="annot"><span class="annottext">w'
</span><a href="#local-6989586621679082241"><span class="hs-identifier hs-var">wt</span></a></span><span> </span><span class="annot"><span class="annottext">w' -&gt; n (b, w') -&gt; n (b, w')
</span><span class="hs-operator hs-var">`seq`</span></span><span> </span><span class="annot"><span class="annottext">(b, w') -&gt; n (b, w')
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679082244"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">w'
</span><a href="#local-6989586621679082241"><span class="hs-identifier hs-var">wt</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-152"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Writer.CPS.html#mapWriterT"><span class="hs-pragma hs-type">mapWriterT</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-153"></span><span>
</span><span id="line-154"></span><span id="local-6989586621679082465"><span id="local-6989586621679082466"><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621679082238"><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#Functor"><span class="hs-identifier hs-type">Functor</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082466"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#Functor"><span class="hs-identifier hs-type">Functor</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Control.Monad.Trans.Writer.CPS.html#WriterT"><span class="hs-identifier hs-type">WriterT</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082465"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082466"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-155"></span><span>    </span><span id="local-6989586621679082235"><span class="annot"><span class="annottext">fmap :: forall a b. (a -&gt; b) -&gt; WriterT w m a -&gt; WriterT w m b
</span><a href="../../base/src/GHC.Base.html#fmap"><span class="hs-identifier hs-var hs-var hs-var hs-var">fmap</span></a></span></span><span> </span><span id="local-6989586621679082234"><span class="annot"><span class="annottext">a -&gt; b
</span><a href="#local-6989586621679082234"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679082233"><span class="annot"><span class="annottext">WriterT w m a
</span><a href="#local-6989586621679082233"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(w -&gt; m (b, w)) -&gt; WriterT w m b
forall w (m :: * -&gt; *) a. (w -&gt; m (a, w)) -&gt; WriterT w m a
</span><a href="Control.Monad.Trans.Writer.CPS.html#WriterT"><span class="hs-identifier hs-var">WriterT</span></a></span><span> </span><span class="annot"><span class="annottext">((w -&gt; m (b, w)) -&gt; WriterT w m b)
-&gt; (w -&gt; m (b, w)) -&gt; WriterT w m b
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621679082232"><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679082232"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span> </span><span class="hs-special">(</span><span id="local-6989586621679082231"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679082231"><span class="hs-identifier hs-var">a</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679082230"><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679082230"><span class="hs-identifier hs-var">w'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; b
</span><a href="#local-6989586621679082234"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679082231"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679082230"><span class="hs-identifier hs-var">w'</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">((a, w) -&gt; (b, w)) -&gt; m (a, w) -&gt; m (b, w)
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/Data.Functor.html#%3C%24%3E"><span class="hs-operator hs-var">&lt;$&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">WriterT w m a -&gt; w -&gt; m (a, w)
forall w (m :: * -&gt; *) a. WriterT w m a -&gt; w -&gt; m (a, w)
</span><a href="Control.Monad.Trans.Writer.CPS.html#unWriterT"><span class="hs-identifier hs-var hs-var">unWriterT</span></a></span><span> </span><span class="annot"><span class="annottext">WriterT w m a
</span><a href="#local-6989586621679082233"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679082232"><span class="hs-identifier hs-var">w</span></a></span><span>
</span><span id="line-156"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#fmap"><span class="hs-pragma hs-type">fmap</span></a></span><span> </span><span class="hs-pragma">#-}</span></span></span><span>
</span><span id="line-157"></span><span>
</span><span id="line-158"></span><span id="local-6989586621679082450"><span id="local-6989586621679082451"><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621679082220"><span id="local-6989586621679082222"><span id="local-6989586621679082224"><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#Functor"><span class="hs-identifier hs-type">Functor</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082451"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#Monad"><span class="hs-identifier hs-type">Monad</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082451"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#Applicative"><span class="hs-identifier hs-type">Applicative</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Control.Monad.Trans.Writer.CPS.html#WriterT"><span class="hs-identifier hs-type">WriterT</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082450"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082451"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span></span></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-159"></span><span>    </span><span id="local-6989586621679082217"><span class="annot"><span class="annottext">pure :: forall a. a -&gt; WriterT w m a
</span><a href="../../base/src/GHC.Base.html#pure"><span class="hs-identifier hs-var hs-var hs-var hs-var">pure</span></a></span></span><span> </span><span id="local-6989586621679082216"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679082216"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(w -&gt; m (a, w)) -&gt; WriterT w m a
forall w (m :: * -&gt; *) a. (w -&gt; m (a, w)) -&gt; WriterT w m a
</span><a href="Control.Monad.Trans.Writer.CPS.html#WriterT"><span class="hs-identifier hs-var">WriterT</span></a></span><span> </span><span class="annot"><span class="annottext">((w -&gt; m (a, w)) -&gt; WriterT w m a)
-&gt; (w -&gt; m (a, w)) -&gt; WriterT w m a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621679082215"><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679082215"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">(a, w) -&gt; m (a, w)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679082216"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679082215"><span class="hs-identifier hs-var">w</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-160"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#pure"><span class="hs-pragma hs-type">pure</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-161"></span><span>
</span><span id="line-162"></span><span>    </span><span class="annot"><a href="Control.Monad.Trans.Writer.CPS.html#WriterT"><span class="hs-identifier hs-type">WriterT</span></a></span><span> </span><span id="local-6989586621679082211"><span class="annot"><span class="annottext">w -&gt; m (a -&gt; b, w)
</span><a href="#local-6989586621679082211"><span class="hs-identifier hs-var">mf</span></a></span></span><span> </span><span id="local-6989586621679082210"><span class="annot"><span class="annottext">&lt;*&gt; :: forall a b. WriterT w m (a -&gt; b) -&gt; WriterT w m a -&gt; WriterT w m b
</span><a href="../../base/src/GHC.Base.html#%3C%2A%3E"><span class="hs-operator hs-var hs-var hs-var hs-var">&lt;*&gt;</span></a></span></span><span> </span><span class="annot"><a href="Control.Monad.Trans.Writer.CPS.html#WriterT"><span class="hs-identifier hs-type">WriterT</span></a></span><span> </span><span id="local-6989586621679082209"><span class="annot"><span class="annottext">w -&gt; m (a, w)
</span><a href="#local-6989586621679082209"><span class="hs-identifier hs-var">mx</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(w -&gt; m (b, w)) -&gt; WriterT w m b
forall w (m :: * -&gt; *) a. (w -&gt; m (a, w)) -&gt; WriterT w m a
</span><a href="Control.Monad.Trans.Writer.CPS.html#WriterT"><span class="hs-identifier hs-var">WriterT</span></a></span><span> </span><span class="annot"><span class="annottext">((w -&gt; m (b, w)) -&gt; WriterT w m b)
-&gt; (w -&gt; m (b, w)) -&gt; WriterT w m b
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621679082208"><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679082208"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-163"></span><span>        </span><span class="hs-special">(</span><span id="local-6989586621679082207"><span class="annot"><span class="annottext">a -&gt; b
</span><a href="#local-6989586621679082207"><span class="hs-identifier hs-var">f</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679082206"><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679082206"><span class="hs-identifier hs-var">w'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">w -&gt; m (a -&gt; b, w)
</span><a href="#local-6989586621679082211"><span class="hs-identifier hs-var">mf</span></a></span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679082208"><span class="hs-identifier hs-var">w</span></a></span><span>
</span><span id="line-164"></span><span>        </span><span class="hs-special">(</span><span id="local-6989586621679082205"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679082205"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679082204"><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679082204"><span class="hs-identifier hs-var">w''</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">w -&gt; m (a, w)
</span><a href="#local-6989586621679082209"><span class="hs-identifier hs-var">mx</span></a></span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679082206"><span class="hs-identifier hs-var">w'</span></a></span><span>
</span><span id="line-165"></span><span>        </span><span class="annot"><span class="annottext">(b, w) -&gt; m (b, w)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; b
</span><a href="#local-6989586621679082207"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679082205"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679082204"><span class="hs-identifier hs-var">w''</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-166"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">(</span><span class="hs-pragma">&lt;*&gt;</span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">#-}</span></span></span><span>
</span><span id="line-167"></span><span>
</span><span id="line-168"></span><span id="local-6989586621679082440"><span id="local-6989586621679082441"><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621679082196"><span id="local-6989586621679082198"><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#Functor"><span class="hs-identifier hs-type">Functor</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082441"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#MonadPlus"><span class="hs-identifier hs-type">MonadPlus</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082441"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#Alternative"><span class="hs-identifier hs-type">Alternative</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Control.Monad.Trans.Writer.CPS.html#WriterT"><span class="hs-identifier hs-type">WriterT</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082440"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082441"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-169"></span><span>    </span><span id="local-6989586621679082193"><span class="annot"><span class="annottext">empty :: forall a. WriterT w m a
</span><a href="../../base/src/GHC.Base.html#empty"><span class="hs-identifier hs-var hs-var hs-var hs-var">empty</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(w -&gt; m (a, w)) -&gt; WriterT w m a
forall w (m :: * -&gt; *) a. (w -&gt; m (a, w)) -&gt; WriterT w m a
</span><a href="Control.Monad.Trans.Writer.CPS.html#WriterT"><span class="hs-identifier hs-var">WriterT</span></a></span><span> </span><span class="annot"><span class="annottext">((w -&gt; m (a, w)) -&gt; WriterT w m a)
-&gt; (w -&gt; m (a, w)) -&gt; WriterT w m a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">m (a, w) -&gt; w -&gt; m (a, w)
forall a b. a -&gt; b -&gt; a
</span><a href="../../base/src/GHC.Base.html#const"><span class="hs-identifier hs-var">const</span></a></span><span> </span><span class="annot"><span class="annottext">m (a, w)
forall (m :: * -&gt; *) a. MonadPlus m =&gt; m a
</span><a href="../../base/src/GHC.Base.html#mzero"><span class="hs-identifier hs-var">mzero</span></a></span><span>
</span><span id="line-170"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#empty"><span class="hs-pragma hs-type">empty</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-171"></span><span>
</span><span id="line-172"></span><span>    </span><span class="annot"><a href="Control.Monad.Trans.Writer.CPS.html#WriterT"><span class="hs-identifier hs-type">WriterT</span></a></span><span> </span><span id="local-6989586621679082188"><span class="annot"><span class="annottext">w -&gt; m (a, w)
</span><a href="#local-6989586621679082188"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span id="local-6989586621679082187"><span class="annot"><span class="annottext">&lt;|&gt; :: forall a. WriterT w m a -&gt; WriterT w m a -&gt; WriterT w m a
</span><a href="../../base/src/GHC.Base.html#%3C%7C%3E"><span class="hs-operator hs-var hs-var hs-var hs-var">&lt;|&gt;</span></a></span></span><span> </span><span class="annot"><a href="Control.Monad.Trans.Writer.CPS.html#WriterT"><span class="hs-identifier hs-type">WriterT</span></a></span><span> </span><span id="local-6989586621679082185"><span class="annot"><span class="annottext">w -&gt; m (a, w)
</span><a href="#local-6989586621679082185"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(w -&gt; m (a, w)) -&gt; WriterT w m a
forall w (m :: * -&gt; *) a. (w -&gt; m (a, w)) -&gt; WriterT w m a
</span><a href="Control.Monad.Trans.Writer.CPS.html#WriterT"><span class="hs-identifier hs-var">WriterT</span></a></span><span> </span><span class="annot"><span class="annottext">((w -&gt; m (a, w)) -&gt; WriterT w m a)
-&gt; (w -&gt; m (a, w)) -&gt; WriterT w m a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621679082184"><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679082184"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">w -&gt; m (a, w)
</span><a href="#local-6989586621679082188"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679082184"><span class="hs-identifier hs-var">w</span></a></span><span> </span><span class="annot"><span class="annottext">m (a, w) -&gt; m (a, w) -&gt; m (a, w)
forall (m :: * -&gt; *) a. MonadPlus m =&gt; m a -&gt; m a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#mplus"><span class="hs-operator hs-var">`mplus`</span></a></span><span> </span><span class="annot"><span class="annottext">w -&gt; m (a, w)
</span><a href="#local-6989586621679082185"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679082184"><span class="hs-identifier hs-var">w</span></a></span><span>
</span><span id="line-173"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">(</span><span class="hs-pragma">&lt;|&gt;</span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">#-}</span></span></span><span>
</span><span id="line-174"></span><span>
</span><span id="line-175"></span><span id="local-6989586621679082428"><span id="local-6989586621679082429"><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621679082176"><span id="local-6989586621679082178"><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#Monad"><span class="hs-identifier hs-type">Monad</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082429"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#Monad"><span class="hs-identifier hs-type">Monad</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Control.Monad.Trans.Writer.CPS.html#WriterT"><span class="hs-identifier hs-type">WriterT</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082428"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082429"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span></span></span><span> </span><span class="hs-keyword">where</span><span class="hs-cpp">
#if !(MIN_VERSION_base(4,8,0))
</span><span>    </span><span class="hs-identifier">return</span><span> </span><span class="hs-identifier">a</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">WriterT</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">w</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">return</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">a</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">w</span><span class="hs-special">)</span><span>
</span><span id="line-178"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">return</span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-181"></span><span>    </span><span id="local-6989586621679082173"><span class="annot"><span class="annottext">WriterT w m a
</span><a href="#local-6989586621679082173"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span id="local-6989586621679082172"><span class="annot"><span class="annottext">&gt;&gt;= :: forall a b. WriterT w m a -&gt; (a -&gt; WriterT w m b) -&gt; WriterT w m b
</span><a href="../../base/src/GHC.Base.html#%3E%3E%3D"><span class="hs-operator hs-var hs-var hs-var hs-var">&gt;&gt;=</span></a></span></span><span> </span><span id="local-6989586621679082171"><span class="annot"><span class="annottext">a -&gt; WriterT w m b
</span><a href="#local-6989586621679082171"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(w -&gt; m (b, w)) -&gt; WriterT w m b
forall w (m :: * -&gt; *) a. (w -&gt; m (a, w)) -&gt; WriterT w m a
</span><a href="Control.Monad.Trans.Writer.CPS.html#WriterT"><span class="hs-identifier hs-var">WriterT</span></a></span><span> </span><span class="annot"><span class="annottext">((w -&gt; m (b, w)) -&gt; WriterT w m b)
-&gt; (w -&gt; m (b, w)) -&gt; WriterT w m b
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621679082170"><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679082170"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-182"></span><span>        </span><span class="hs-special">(</span><span id="local-6989586621679082169"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679082169"><span class="hs-identifier hs-var">a</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679082168"><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679082168"><span class="hs-identifier hs-var">w'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">WriterT w m a -&gt; w -&gt; m (a, w)
forall w (m :: * -&gt; *) a. WriterT w m a -&gt; w -&gt; m (a, w)
</span><a href="Control.Monad.Trans.Writer.CPS.html#unWriterT"><span class="hs-identifier hs-var hs-var">unWriterT</span></a></span><span> </span><span class="annot"><span class="annottext">WriterT w m a
</span><a href="#local-6989586621679082173"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679082170"><span class="hs-identifier hs-var">w</span></a></span><span>
</span><span id="line-183"></span><span>        </span><span class="annot"><span class="annottext">WriterT w m b -&gt; w -&gt; m (b, w)
forall w (m :: * -&gt; *) a. WriterT w m a -&gt; w -&gt; m (a, w)
</span><a href="Control.Monad.Trans.Writer.CPS.html#unWriterT"><span class="hs-identifier hs-var hs-var">unWriterT</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; WriterT w m b
</span><a href="#local-6989586621679082171"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679082169"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679082168"><span class="hs-identifier hs-var">w'</span></a></span><span>
</span><span id="line-184"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">(</span><span class="hs-pragma">&gt;&gt;=</span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">#-}</span></span></span><span class="hs-cpp">

#if !(MIN_VERSION_base(4,13,0))
</span><span>    </span><span class="hs-identifier">fail</span><span> </span><span class="hs-identifier">msg</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">WriterT</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">fail</span><span> </span><span class="hs-identifier">msg</span><span>
</span><span id="line-188"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">fail</span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#endif
</span><span class="hs-cpp">
#if MIN_VERSION_base(4,9,0)
</span><span id="local-6989586621679082420"><span id="local-6989586621679082421"><span class="hs-keyword">instance</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/Control.Monad.Fail.html#MonadFail"><span class="hs-identifier hs-type">Fail.MonadFail</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082421"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="../../base/src/Control.Monad.Fail.html#MonadFail"><span class="hs-identifier hs-type">Fail.MonadFail</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Control.Monad.Trans.Writer.CPS.html#WriterT"><span class="hs-identifier hs-type">WriterT</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082420"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082421"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-193"></span><span>    </span><span id="local-6989586621679082158"><span class="annot"><span class="annottext">fail :: forall a. String -&gt; WriterT w m a
</span><a href="../../base/src/Control.Monad.Fail.html#fail"><span class="hs-identifier hs-var hs-var hs-var hs-var">fail</span></a></span></span><span> </span><span id="local-6989586621679082157"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679082157"><span class="hs-identifier hs-var">msg</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(w -&gt; m (a, w)) -&gt; WriterT w m a
forall w (m :: * -&gt; *) a. (w -&gt; m (a, w)) -&gt; WriterT w m a
</span><a href="Control.Monad.Trans.Writer.CPS.html#WriterT"><span class="hs-identifier hs-var">WriterT</span></a></span><span> </span><span class="annot"><span class="annottext">((w -&gt; m (a, w)) -&gt; WriterT w m a)
-&gt; (w -&gt; m (a, w)) -&gt; WriterT w m a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span> </span><span class="annot"><span class="annottext">w
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; m (a, w)
forall (m :: * -&gt; *) a. MonadFail m =&gt; String -&gt; m a
</span><a href="../../base/src/Control.Monad.Fail.html#fail"><span class="hs-identifier hs-var">Fail.fail</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679082157"><span class="hs-identifier hs-var">msg</span></a></span><span>
</span><span id="line-194"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="../../base/src/Control.Monad.Fail.html#fail"><span class="hs-pragma hs-type">fail</span></a></span><span> </span><span class="hs-pragma">#-}</span></span></span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-197"></span><span id="local-6989586621679082415"><span id="local-6989586621679082416"><span class="hs-keyword">instance</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#Functor"><span class="hs-identifier hs-type">Functor</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082416"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#MonadPlus"><span class="hs-identifier hs-type">MonadPlus</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082416"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#MonadPlus"><span class="hs-identifier hs-type">MonadPlus</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Control.Monad.Trans.Writer.CPS.html#WriterT"><span class="hs-identifier hs-type">WriterT</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082415"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082416"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-198"></span><span>    </span><span id="local-6989586621679082144"><span class="annot"><span class="annottext">mzero :: forall a. WriterT w m a
</span><a href="#local-6989586621679082144"><span class="hs-identifier hs-var hs-var hs-var hs-var">mzero</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">WriterT w m a
forall (f :: * -&gt; *) a. Alternative f =&gt; f a
</span><a href="../../base/src/GHC.Base.html#empty"><span class="hs-identifier hs-var">empty</span></a></span><span>
</span><span id="line-199"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#mzero"><span class="hs-pragma hs-type">mzero</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-200"></span><span>    </span><span id="local-6989586621679082142"><span class="annot"><span class="annottext">mplus :: forall a. WriterT w m a -&gt; WriterT w m a -&gt; WriterT w m a
</span><a href="#local-6989586621679082142"><span class="hs-identifier hs-var hs-var hs-var hs-var">mplus</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">WriterT w m a -&gt; WriterT w m a -&gt; WriterT w m a
forall (f :: * -&gt; *) a. Alternative f =&gt; f a -&gt; f a -&gt; f a
</span><a href="../../base/src/GHC.Base.html#%3C%7C%3E"><span class="hs-operator hs-var">(&lt;|&gt;)</span></a></span><span>
</span><span id="line-201"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#mplus"><span class="hs-pragma hs-type">mplus</span></a></span><span> </span><span class="hs-pragma">#-}</span></span></span><span>
</span><span id="line-202"></span><span>
</span><span id="line-203"></span><span id="local-6989586621679082407"><span id="local-6989586621679082408"><span class="hs-keyword">instance</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/Control.Monad.Fix.html#MonadFix"><span class="hs-identifier hs-type">MonadFix</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082408"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="../../base/src/Control.Monad.Fix.html#MonadFix"><span class="hs-identifier hs-type">MonadFix</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Control.Monad.Trans.Writer.CPS.html#WriterT"><span class="hs-identifier hs-type">WriterT</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082407"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082408"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-204"></span><span>    </span><span id="local-6989586621679082132"><span class="annot"><span class="annottext">mfix :: forall a. (a -&gt; WriterT w m a) -&gt; WriterT w m a
</span><a href="../../base/src/Control.Monad.Fix.html#mfix"><span class="hs-identifier hs-var hs-var hs-var hs-var">mfix</span></a></span></span><span> </span><span id="local-6989586621679082131"><span class="annot"><span class="annottext">a -&gt; WriterT w m a
</span><a href="#local-6989586621679082131"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(w -&gt; m (a, w)) -&gt; WriterT w m a
forall w (m :: * -&gt; *) a. (w -&gt; m (a, w)) -&gt; WriterT w m a
</span><a href="Control.Monad.Trans.Writer.CPS.html#WriterT"><span class="hs-identifier hs-var">WriterT</span></a></span><span> </span><span class="annot"><span class="annottext">((w -&gt; m (a, w)) -&gt; WriterT w m a)
-&gt; (w -&gt; m (a, w)) -&gt; WriterT w m a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621679082130"><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679082130"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">((a, w) -&gt; m (a, w)) -&gt; m (a, w)
forall (m :: * -&gt; *) a. MonadFix m =&gt; (a -&gt; m a) -&gt; m a
</span><a href="../../base/src/Control.Monad.Fix.html#mfix"><span class="hs-identifier hs-var">mfix</span></a></span><span> </span><span class="annot"><span class="annottext">(((a, w) -&gt; m (a, w)) -&gt; m (a, w))
-&gt; ((a, w) -&gt; m (a, w)) -&gt; m (a, w)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-glyph">~</span><span class="hs-special">(</span><span id="local-6989586621679082129"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679082129"><span class="hs-identifier hs-var">a</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">w
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">WriterT w m a -&gt; w -&gt; m (a, w)
forall w (m :: * -&gt; *) a. WriterT w m a -&gt; w -&gt; m (a, w)
</span><a href="Control.Monad.Trans.Writer.CPS.html#unWriterT"><span class="hs-identifier hs-var hs-var">unWriterT</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; WriterT w m a
</span><a href="#local-6989586621679082131"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679082129"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679082130"><span class="hs-identifier hs-var">w</span></a></span><span>
</span><span id="line-205"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="../../base/src/Control.Monad.Fix.html#mfix"><span class="hs-pragma hs-type">mfix</span></a></span><span> </span><span class="hs-pragma">#-}</span></span></span><span>
</span><span id="line-206"></span><span>
</span><span id="line-207"></span><span id="local-6989586621679082400"><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Class.html#MonadTrans"><span class="hs-identifier hs-type">MonadTrans</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Control.Monad.Trans.Writer.CPS.html#WriterT"><span class="hs-identifier hs-type">WriterT</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082400"><span class="hs-identifier hs-type">w</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-208"></span><span>    </span><span id="local-6989586621679082122"><span class="annot"><span class="annottext">lift :: forall (m :: * -&gt; *) a. Monad m =&gt; m a -&gt; WriterT w m a
</span><a href="Control.Monad.Trans.Class.html#lift"><span class="hs-identifier hs-var hs-var hs-var hs-var">lift</span></a></span></span><span> </span><span id="local-6989586621679082120"><span class="annot"><span class="annottext">m a
</span><a href="#local-6989586621679082120"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(w -&gt; m (a, w)) -&gt; WriterT w m a
forall w (m :: * -&gt; *) a. (w -&gt; m (a, w)) -&gt; WriterT w m a
</span><a href="Control.Monad.Trans.Writer.CPS.html#WriterT"><span class="hs-identifier hs-var">WriterT</span></a></span><span> </span><span class="annot"><span class="annottext">((w -&gt; m (a, w)) -&gt; WriterT w m a)
-&gt; (w -&gt; m (a, w)) -&gt; WriterT w m a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621679082119"><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679082119"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-209"></span><span>        </span><span id="local-6989586621679082118"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679082118"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">m a
</span><a href="#local-6989586621679082120"><span class="hs-identifier hs-var">m</span></a></span><span>
</span><span id="line-210"></span><span>        </span><span class="annot"><span class="annottext">(a, w) -&gt; m (a, w)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679082118"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679082119"><span class="hs-identifier hs-var">w</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-211"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Class.html#lift"><span class="hs-pragma hs-type">lift</span></a></span><span> </span><span class="hs-pragma">#-}</span></span><span>
</span><span id="line-212"></span><span>
</span><span id="line-213"></span><span id="local-6989586621679082391"><span id="local-6989586621679082392"><span class="hs-keyword">instance</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/Control.Monad.IO.Class.html#MonadIO"><span class="hs-identifier hs-type">MonadIO</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082392"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="../../base/src/Control.Monad.IO.Class.html#MonadIO"><span class="hs-identifier hs-type">MonadIO</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Control.Monad.Trans.Writer.CPS.html#WriterT"><span class="hs-identifier hs-type">WriterT</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082391"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082392"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-214"></span><span>    </span><span id="local-6989586621679082106"><span class="annot"><span class="annottext">liftIO :: forall a. IO a -&gt; WriterT w m a
</span><a href="../../base/src/Control.Monad.IO.Class.html#liftIO"><span class="hs-identifier hs-var hs-var hs-var hs-var">liftIO</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">m a -&gt; WriterT w m a
forall (t :: (* -&gt; *) -&gt; * -&gt; *) (m :: * -&gt; *) a.
(MonadTrans t, Monad m) =&gt;
m a -&gt; t m a
</span><a href="Control.Monad.Trans.Class.html#lift"><span class="hs-identifier hs-var">lift</span></a></span><span> </span><span class="annot"><span class="annottext">(m a -&gt; WriterT w m a) -&gt; (IO a -&gt; m a) -&gt; IO a -&gt; WriterT w m a
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">IO a -&gt; m a
forall (m :: * -&gt; *) a. MonadIO m =&gt; IO a -&gt; m a
</span><a href="../../base/src/Control.Monad.IO.Class.html#liftIO"><span class="hs-identifier hs-var">liftIO</span></a></span><span>
</span><span id="line-215"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="../../base/src/Control.Monad.IO.Class.html#liftIO"><span class="hs-pragma hs-type">liftIO</span></a></span><span> </span><span class="hs-pragma">#-}</span></span></span><span>
</span><span id="line-216"></span><span>
</span><span id="line-217"></span><span class="hs-comment">-- | @'tell' w@ is an action that produces the output @w@.</span><span>
</span><span id="line-218"></span><span id="local-6989586621679082388"><span id="local-6989586621679082389"><span class="annot"><a href="Control.Monad.Trans.Writer.CPS.html#tell"><span class="hs-identifier hs-type">tell</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#Monoid"><span class="hs-identifier hs-type">Monoid</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082389"><span class="hs-identifier hs-type">w</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#Monad"><span class="hs-identifier hs-type">Monad</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082388"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679082389"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Writer.CPS.html#WriterT"><span class="hs-identifier hs-type">WriterT</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082389"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082388"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span></span></span><span>
</span><span id="line-219"></span><span id="tell"><span class="annot"><span class="annottext">tell :: forall w (m :: * -&gt; *). (Monoid w, Monad m) =&gt; w -&gt; WriterT w m ()
</span><a href="Control.Monad.Trans.Writer.CPS.html#tell"><span class="hs-identifier hs-var hs-var">tell</span></a></span></span><span> </span><span id="local-6989586621679082100"><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679082100"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">((), w) -&gt; WriterT w m ()
forall w (m :: * -&gt; *) a.
(Monoid w, Monad m) =&gt;
(a, w) -&gt; WriterT w m a
</span><a href="Control.Monad.Trans.Writer.CPS.html#writer"><span class="hs-identifier hs-var">writer</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679082100"><span class="hs-identifier hs-var">w</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-220"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Writer.CPS.html#tell"><span class="hs-pragma hs-type">tell</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-221"></span><span>
</span><span id="line-222"></span><span class="hs-comment">-- | @'listen' m@ is an action that executes the action @m@ and adds its</span><span>
</span><span id="line-223"></span><span class="hs-comment">-- output to the value of the computation.</span><span>
</span><span id="line-224"></span><span class="hs-comment">--</span><span>
</span><span id="line-225"></span><span class="hs-comment">-- * @'runWriterT' ('listen' m) = 'liftM' (\\ (a, w) -&gt; ((a, w), w)) ('runWriterT' m)@</span><span>
</span><span id="line-226"></span><span id="local-6989586621679082383"><span id="local-6989586621679082384"><span id="local-6989586621679082385"><span class="annot"><a href="Control.Monad.Trans.Writer.CPS.html#listen"><span class="hs-identifier hs-type">listen</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#Monoid"><span class="hs-identifier hs-type">Monoid</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082385"><span class="hs-identifier hs-type">w</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#Monad"><span class="hs-identifier hs-type">Monad</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082384"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Writer.CPS.html#WriterT"><span class="hs-identifier hs-type">WriterT</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082385"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082384"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082383"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Writer.CPS.html#WriterT"><span class="hs-identifier hs-type">WriterT</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082385"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082384"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679082383"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621679082385"><span class="hs-identifier hs-type">w</span></a></span><span class="hs-special">)</span></span></span></span><span>
</span><span id="line-227"></span><span id="listen"><span class="annot"><span class="annottext">listen :: forall w (m :: * -&gt; *) a.
(Monoid w, Monad m) =&gt;
WriterT w m a -&gt; WriterT w m (a, w)
</span><a href="Control.Monad.Trans.Writer.CPS.html#listen"><span class="hs-identifier hs-var hs-var">listen</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(w -&gt; w) -&gt; WriterT w m a -&gt; WriterT w m (a, w)
forall w (m :: * -&gt; *) b a.
(Monoid w, Monad m) =&gt;
(w -&gt; b) -&gt; WriterT w m a -&gt; WriterT w m (a, b)
</span><a href="Control.Monad.Trans.Writer.CPS.html#listens"><span class="hs-identifier hs-var">listens</span></a></span><span> </span><span class="annot"><span class="annottext">w -&gt; w
forall a. a -&gt; a
</span><a href="../../base/src/GHC.Base.html#id"><span class="hs-identifier hs-var">id</span></a></span><span>
</span><span id="line-228"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Writer.CPS.html#listen"><span class="hs-pragma hs-type">listen</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-229"></span><span>
</span><span id="line-230"></span><span class="hs-comment">-- | @'listens' f m@ is an action that executes the action @m@ and adds</span><span>
</span><span id="line-231"></span><span class="hs-comment">-- the result of applying @f@ to the output to the value of the computation.</span><span>
</span><span id="line-232"></span><span class="hs-comment">--</span><span>
</span><span id="line-233"></span><span class="hs-comment">-- * @'listens' f m = 'liftM' (id *** f) ('listen' m)@</span><span>
</span><span id="line-234"></span><span class="hs-comment">--</span><span>
</span><span id="line-235"></span><span class="hs-comment">-- * @'runWriterT' ('listens' f m) = 'liftM' (\\ (a, w) -&gt; ((a, f w), w)) ('runWriterT' m)@</span><span>
</span><span id="line-236"></span><span id="local-6989586621679082376"><span id="local-6989586621679082377"><span id="local-6989586621679082378"><span id="local-6989586621679082379"><span class="annot"><a href="Control.Monad.Trans.Writer.CPS.html#listens"><span class="hs-identifier hs-type">listens</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#Monoid"><span class="hs-identifier hs-type">Monoid</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082379"><span class="hs-identifier hs-type">w</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#Monad"><span class="hs-identifier hs-type">Monad</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082378"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span>
</span><span id="line-237"></span><span>    </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679082379"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679082377"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Writer.CPS.html#WriterT"><span class="hs-identifier hs-type">WriterT</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082379"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082378"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082376"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Writer.CPS.html#WriterT"><span class="hs-identifier hs-type">WriterT</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082379"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082378"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679082376"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621679082377"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span></span></span></span></span><span>
</span><span id="line-238"></span><span id="listens"><span class="annot"><span class="annottext">listens :: forall w (m :: * -&gt; *) b a.
(Monoid w, Monad m) =&gt;
(w -&gt; b) -&gt; WriterT w m a -&gt; WriterT w m (a, b)
</span><a href="Control.Monad.Trans.Writer.CPS.html#listens"><span class="hs-identifier hs-var hs-var">listens</span></a></span></span><span> </span><span id="local-6989586621679082089"><span class="annot"><span class="annottext">w -&gt; b
</span><a href="#local-6989586621679082089"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679082088"><span class="annot"><span class="annottext">WriterT w m a
</span><a href="#local-6989586621679082088"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(w -&gt; m ((a, b), w)) -&gt; WriterT w m (a, b)
forall w (m :: * -&gt; *) a. (w -&gt; m (a, w)) -&gt; WriterT w m a
</span><a href="Control.Monad.Trans.Writer.CPS.html#WriterT"><span class="hs-identifier hs-var">WriterT</span></a></span><span> </span><span class="annot"><span class="annottext">((w -&gt; m ((a, b), w)) -&gt; WriterT w m (a, b))
-&gt; (w -&gt; m ((a, b), w)) -&gt; WriterT w m (a, b)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621679082087"><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679082087"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-239"></span><span>    </span><span class="hs-special">(</span><span id="local-6989586621679082086"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679082086"><span class="hs-identifier hs-var">a</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679082085"><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679082085"><span class="hs-identifier hs-var">w'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">WriterT w m a -&gt; m (a, w)
forall w (m :: * -&gt; *) a. Monoid w =&gt; WriterT w m a -&gt; m (a, w)
</span><a href="Control.Monad.Trans.Writer.CPS.html#runWriterT"><span class="hs-identifier hs-var">runWriterT</span></a></span><span> </span><span class="annot"><span class="annottext">WriterT w m a
</span><a href="#local-6989586621679082088"><span class="hs-identifier hs-var">m</span></a></span><span>
</span><span id="line-240"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621679082083"><span class="annot"><span class="annottext">wt :: w
</span><a href="#local-6989586621679082083"><span class="hs-identifier hs-var hs-var">wt</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679082087"><span class="hs-identifier hs-var">w</span></a></span><span> </span><span class="annot"><span class="annottext">w -&gt; w -&gt; w
forall a. Monoid a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Base.html#mappend"><span class="hs-operator hs-var">`mappend`</span></a></span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679082085"><span class="hs-identifier hs-var">w'</span></a></span><span>
</span><span id="line-241"></span><span>    </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679082083"><span class="hs-identifier hs-var">wt</span></a></span><span> </span><span class="annot"><span class="annottext">w -&gt; m ((a, b), w) -&gt; m ((a, b), w)
</span><span class="hs-operator hs-var">`seq`</span></span><span> </span><span class="annot"><span class="annottext">((a, b), w) -&gt; m ((a, b), w)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679082086"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">w -&gt; b
</span><a href="#local-6989586621679082089"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679082085"><span class="hs-identifier hs-var">w'</span></a></span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679082083"><span class="hs-identifier hs-var">wt</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-242"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Writer.CPS.html#listens"><span class="hs-pragma hs-type">listens</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-243"></span><span>
</span><span id="line-244"></span><span class="hs-comment">-- | @'pass' m@ is an action that executes the action @m@, which returns</span><span>
</span><span id="line-245"></span><span class="hs-comment">-- a value and a function, and returns the value, applying the function</span><span>
</span><span id="line-246"></span><span class="hs-comment">-- to the output.</span><span>
</span><span id="line-247"></span><span class="hs-comment">--</span><span>
</span><span id="line-248"></span><span class="hs-comment">-- * @'runWriterT' ('pass' m) = 'liftM' (\\ ((a, f), w) -&gt; (a, f w)) ('runWriterT' m)@</span><span>
</span><span id="line-249"></span><span id="local-6989586621679082367"><span id="local-6989586621679082368"><span id="local-6989586621679082369"><span id="local-6989586621679082370"><span class="annot"><a href="Control.Monad.Trans.Writer.CPS.html#pass"><span class="hs-identifier hs-type">pass</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#Monoid"><span class="hs-identifier hs-type">Monoid</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082370"><span class="hs-identifier hs-type">w</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#Monoid"><span class="hs-identifier hs-type">Monoid</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082369"><span class="hs-identifier hs-type">w'</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#Monad"><span class="hs-identifier hs-type">Monad</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082368"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span>
</span><span id="line-250"></span><span>    </span><span class="annot"><a href="Control.Monad.Trans.Writer.CPS.html#WriterT"><span class="hs-identifier hs-type">WriterT</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082370"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082368"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679082367"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621679082370"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679082369"><span class="hs-identifier hs-type">w'</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Writer.CPS.html#WriterT"><span class="hs-identifier hs-type">WriterT</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082369"><span class="hs-identifier hs-type">w'</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082368"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082367"><span class="hs-identifier hs-type">a</span></a></span></span></span></span></span><span>
</span><span id="line-251"></span><span id="pass"><span class="annot"><span class="annottext">pass :: forall w w' (m :: * -&gt; *) a.
(Monoid w, Monoid w', Monad m) =&gt;
WriterT w m (a, w -&gt; w') -&gt; WriterT w' m a
</span><a href="Control.Monad.Trans.Writer.CPS.html#pass"><span class="hs-identifier hs-var hs-var">pass</span></a></span></span><span> </span><span id="local-6989586621679082076"><span class="annot"><span class="annottext">WriterT w m (a, w -&gt; w')
</span><a href="#local-6989586621679082076"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(w' -&gt; m (a, w')) -&gt; WriterT w' m a
forall w (m :: * -&gt; *) a. (w -&gt; m (a, w)) -&gt; WriterT w m a
</span><a href="Control.Monad.Trans.Writer.CPS.html#WriterT"><span class="hs-identifier hs-var">WriterT</span></a></span><span> </span><span class="annot"><span class="annottext">((w' -&gt; m (a, w')) -&gt; WriterT w' m a)
-&gt; (w' -&gt; m (a, w')) -&gt; WriterT w' m a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621679082075"><span class="annot"><span class="annottext">w'
</span><a href="#local-6989586621679082075"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-252"></span><span>    </span><span class="hs-special">(</span><span class="hs-special">(</span><span id="local-6989586621679082074"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679082074"><span class="hs-identifier hs-var">a</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679082073"><span class="annot"><span class="annottext">w -&gt; w'
</span><a href="#local-6989586621679082073"><span class="hs-identifier hs-var">f</span></a></span></span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span id="local-6989586621679082072"><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679082072"><span class="hs-identifier hs-var">w'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">WriterT w m (a, w -&gt; w') -&gt; m ((a, w -&gt; w'), w)
forall w (m :: * -&gt; *) a. Monoid w =&gt; WriterT w m a -&gt; m (a, w)
</span><a href="Control.Monad.Trans.Writer.CPS.html#runWriterT"><span class="hs-identifier hs-var">runWriterT</span></a></span><span> </span><span class="annot"><span class="annottext">WriterT w m (a, w -&gt; w')
</span><a href="#local-6989586621679082076"><span class="hs-identifier hs-var">m</span></a></span><span>
</span><span id="line-253"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621679082070"><span class="annot"><span class="annottext">wt :: w'
</span><a href="#local-6989586621679082070"><span class="hs-identifier hs-var hs-var">wt</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">w'
</span><a href="#local-6989586621679082075"><span class="hs-identifier hs-var">w</span></a></span><span> </span><span class="annot"><span class="annottext">w' -&gt; w' -&gt; w'
forall a. Monoid a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Base.html#mappend"><span class="hs-operator hs-var">`mappend`</span></a></span><span> </span><span class="annot"><span class="annottext">w -&gt; w'
</span><a href="#local-6989586621679082073"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679082072"><span class="hs-identifier hs-var">w'</span></a></span><span>
</span><span id="line-254"></span><span>    </span><span class="annot"><span class="annottext">w'
</span><a href="#local-6989586621679082070"><span class="hs-identifier hs-var">wt</span></a></span><span> </span><span class="annot"><span class="annottext">w' -&gt; m (a, w') -&gt; m (a, w')
</span><span class="hs-operator hs-var">`seq`</span></span><span> </span><span class="annot"><span class="annottext">(a, w') -&gt; m (a, w')
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679082074"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">w'
</span><a href="#local-6989586621679082070"><span class="hs-identifier hs-var">wt</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-255"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Writer.CPS.html#pass"><span class="hs-pragma hs-type">pass</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-256"></span><span>
</span><span id="line-257"></span><span class="hs-comment">-- | @'censor' f m@ is an action that executes the action @m@ and</span><span>
</span><span id="line-258"></span><span class="hs-comment">-- applies the function @f@ to its output, leaving the return value</span><span>
</span><span id="line-259"></span><span class="hs-comment">-- unchanged.</span><span>
</span><span id="line-260"></span><span class="hs-comment">--</span><span>
</span><span id="line-261"></span><span class="hs-comment">-- * @'censor' f m = 'pass' ('liftM' (\\ x -&gt; (x,f)) m)@</span><span>
</span><span id="line-262"></span><span class="hs-comment">--</span><span>
</span><span id="line-263"></span><span class="hs-comment">-- * @'runWriterT' ('censor' f m) = 'liftM' (\\ (a, w) -&gt; (a, f w)) ('runWriterT' m)@</span><span>
</span><span id="line-264"></span><span id="local-6989586621679082360"><span id="local-6989586621679082361"><span id="local-6989586621679082362"><span class="annot"><a href="Control.Monad.Trans.Writer.CPS.html#censor"><span class="hs-identifier hs-type">censor</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#Monoid"><span class="hs-identifier hs-type">Monoid</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082362"><span class="hs-identifier hs-type">w</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#Monad"><span class="hs-identifier hs-type">Monad</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082361"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679082362"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679082362"><span class="hs-identifier hs-type">w</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Writer.CPS.html#WriterT"><span class="hs-identifier hs-type">WriterT</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082362"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082361"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082360"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Writer.CPS.html#WriterT"><span class="hs-identifier hs-type">WriterT</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082362"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082361"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082360"><span class="hs-identifier hs-type">a</span></a></span></span></span></span><span>
</span><span id="line-265"></span><span id="censor"><span class="annot"><span class="annottext">censor :: forall w (m :: * -&gt; *) a.
(Monoid w, Monad m) =&gt;
(w -&gt; w) -&gt; WriterT w m a -&gt; WriterT w m a
</span><a href="Control.Monad.Trans.Writer.CPS.html#censor"><span class="hs-identifier hs-var hs-var">censor</span></a></span></span><span> </span><span id="local-6989586621679082064"><span class="annot"><span class="annottext">w -&gt; w
</span><a href="#local-6989586621679082064"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679082063"><span class="annot"><span class="annottext">WriterT w m a
</span><a href="#local-6989586621679082063"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(w -&gt; m (a, w)) -&gt; WriterT w m a
forall w (m :: * -&gt; *) a. (w -&gt; m (a, w)) -&gt; WriterT w m a
</span><a href="Control.Monad.Trans.Writer.CPS.html#WriterT"><span class="hs-identifier hs-var">WriterT</span></a></span><span> </span><span class="annot"><span class="annottext">((w -&gt; m (a, w)) -&gt; WriterT w m a)
-&gt; (w -&gt; m (a, w)) -&gt; WriterT w m a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621679082062"><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679082062"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-266"></span><span>    </span><span class="hs-special">(</span><span id="local-6989586621679082061"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679082061"><span class="hs-identifier hs-var">a</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679082060"><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679082060"><span class="hs-identifier hs-var">w'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">WriterT w m a -&gt; m (a, w)
forall w (m :: * -&gt; *) a. Monoid w =&gt; WriterT w m a -&gt; m (a, w)
</span><a href="Control.Monad.Trans.Writer.CPS.html#runWriterT"><span class="hs-identifier hs-var">runWriterT</span></a></span><span> </span><span class="annot"><span class="annottext">WriterT w m a
</span><a href="#local-6989586621679082063"><span class="hs-identifier hs-var">m</span></a></span><span>
</span><span id="line-267"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621679082058"><span class="annot"><span class="annottext">wt :: w
</span><a href="#local-6989586621679082058"><span class="hs-identifier hs-var hs-var">wt</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679082062"><span class="hs-identifier hs-var">w</span></a></span><span> </span><span class="annot"><span class="annottext">w -&gt; w -&gt; w
forall a. Monoid a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Base.html#mappend"><span class="hs-operator hs-var">`mappend`</span></a></span><span> </span><span class="annot"><span class="annottext">w -&gt; w
</span><a href="#local-6989586621679082064"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679082060"><span class="hs-identifier hs-var">w'</span></a></span><span>
</span><span id="line-268"></span><span>    </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679082058"><span class="hs-identifier hs-var">wt</span></a></span><span> </span><span class="annot"><span class="annottext">w -&gt; m (a, w) -&gt; m (a, w)
</span><span class="hs-operator hs-var">`seq`</span></span><span> </span><span class="annot"><span class="annottext">(a, w) -&gt; m (a, w)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679082061"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679082058"><span class="hs-identifier hs-var">wt</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-269"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Writer.CPS.html#censor"><span class="hs-pragma hs-type">censor</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-270"></span><span>
</span><span id="line-271"></span><span class="hs-comment">-- | Uniform lifting of a @callCC@ operation to the new monad.</span><span>
</span><span id="line-272"></span><span class="hs-comment">-- This version rolls back to the original state on entering the</span><span>
</span><span id="line-273"></span><span class="hs-comment">-- continuation.</span><span>
</span><span id="line-274"></span><span id="local-6989586621679082353"><span id="local-6989586621679082354"><span id="local-6989586621679082355"><span id="local-6989586621679082356"><span class="annot"><a href="Control.Monad.Trans.Writer.CPS.html#liftCallCC"><span class="hs-identifier hs-type">liftCallCC</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Control.Monad.Signatures.html#CallCC"><span class="hs-identifier hs-type">CallCC</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082356"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679082355"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621679082354"><span class="hs-identifier hs-type">w</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679082353"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621679082354"><span class="hs-identifier hs-type">w</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Control.Monad.Signatures.html#CallCC"><span class="hs-identifier hs-type">CallCC</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Control.Monad.Trans.Writer.CPS.html#WriterT"><span class="hs-identifier hs-type">WriterT</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082354"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082356"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><a href="#local-6989586621679082355"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082353"><span class="hs-identifier hs-type">b</span></a></span></span></span></span></span><span>
</span><span id="line-275"></span><span id="liftCallCC"><span class="annot"><span class="annottext">liftCallCC :: forall (m :: * -&gt; *) a w b.
CallCC m (a, w) (b, w) -&gt; CallCC (WriterT w m) a b
</span><a href="Control.Monad.Trans.Writer.CPS.html#liftCallCC"><span class="hs-identifier hs-var hs-var">liftCallCC</span></a></span></span><span> </span><span id="local-6989586621679082057"><span class="annot"><span class="annottext">CallCC m (a, w) (b, w)
</span><a href="#local-6989586621679082057"><span class="hs-identifier hs-var">callCC</span></a></span></span><span> </span><span id="local-6989586621679082056"><span class="annot"><span class="annottext">(a -&gt; WriterT w m b) -&gt; WriterT w m a
</span><a href="#local-6989586621679082056"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(w -&gt; m (a, w)) -&gt; WriterT w m a
forall w (m :: * -&gt; *) a. (w -&gt; m (a, w)) -&gt; WriterT w m a
</span><a href="Control.Monad.Trans.Writer.CPS.html#WriterT"><span class="hs-identifier hs-var">WriterT</span></a></span><span> </span><span class="annot"><span class="annottext">((w -&gt; m (a, w)) -&gt; WriterT w m a)
-&gt; (w -&gt; m (a, w)) -&gt; WriterT w m a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621679082055"><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679082055"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-276"></span><span>    </span><span class="annot"><span class="annottext">CallCC m (a, w) (b, w)
</span><a href="#local-6989586621679082057"><span class="hs-identifier hs-var">callCC</span></a></span><span> </span><span class="annot"><span class="annottext">CallCC m (a, w) (b, w) -&gt; CallCC m (a, w) (b, w)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621679082054"><span class="annot"><span class="annottext">(a, w) -&gt; m (b, w)
</span><a href="#local-6989586621679082054"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">WriterT w m a -&gt; w -&gt; m (a, w)
forall w (m :: * -&gt; *) a. WriterT w m a -&gt; w -&gt; m (a, w)
</span><a href="Control.Monad.Trans.Writer.CPS.html#unWriterT"><span class="hs-identifier hs-var hs-var">unWriterT</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(a -&gt; WriterT w m b) -&gt; WriterT w m a
</span><a href="#local-6989586621679082056"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621679082053"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679082053"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">(w -&gt; m (b, w)) -&gt; WriterT w m b
forall w (m :: * -&gt; *) a. (w -&gt; m (a, w)) -&gt; WriterT w m a
</span><a href="Control.Monad.Trans.Writer.CPS.html#WriterT"><span class="hs-identifier hs-var">WriterT</span></a></span><span> </span><span class="annot"><span class="annottext">((w -&gt; m (b, w)) -&gt; WriterT w m b)
-&gt; (w -&gt; m (b, w)) -&gt; WriterT w m b
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span> </span><span class="annot"><span class="annottext">w
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">(a, w) -&gt; m (b, w)
</span><a href="#local-6989586621679082054"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679082053"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679082055"><span class="hs-identifier hs-var">w</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679082055"><span class="hs-identifier hs-var">w</span></a></span><span>
</span><span id="line-277"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Writer.CPS.html#liftCallCC"><span class="hs-pragma hs-type">liftCallCC</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-278"></span><span>
</span><span id="line-279"></span><span class="hs-comment">-- | Lift a @catchE@ operation to the new monad.</span><span>
</span><span id="line-280"></span><span id="local-6989586621679082344"><span id="local-6989586621679082345"><span id="local-6989586621679082346"><span id="local-6989586621679082347"><span class="annot"><a href="Control.Monad.Trans.Writer.CPS.html#liftCatch"><span class="hs-identifier hs-type">liftCatch</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Control.Monad.Signatures.html#Catch"><span class="hs-identifier hs-type">Catch</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082347"><span class="hs-identifier hs-type">e</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082346"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679082345"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621679082344"><span class="hs-identifier hs-type">w</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Control.Monad.Signatures.html#Catch"><span class="hs-identifier hs-type">Catch</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082347"><span class="hs-identifier hs-type">e</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Control.Monad.Trans.Writer.CPS.html#WriterT"><span class="hs-identifier hs-type">WriterT</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082344"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679082346"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><a href="#local-6989586621679082345"><span class="hs-identifier hs-type">a</span></a></span></span></span></span></span><span>
</span><span id="line-281"></span><span id="liftCatch"><span class="annot"><span class="annottext">liftCatch :: forall e (m :: * -&gt; *) a w.
Catch e m (a, w) -&gt; Catch e (WriterT w m) a
</span><a href="Control.Monad.Trans.Writer.CPS.html#liftCatch"><span class="hs-identifier hs-var hs-var">liftCatch</span></a></span></span><span> </span><span id="local-6989586621679082052"><span class="annot"><span class="annottext">Catch e m (a, w)
</span><a href="#local-6989586621679082052"><span class="hs-identifier hs-var">catchE</span></a></span></span><span> </span><span id="local-6989586621679082051"><span class="annot"><span class="annottext">WriterT w m a
</span><a href="#local-6989586621679082051"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span id="local-6989586621679082050"><span class="annot"><span class="annottext">e -&gt; WriterT w m a
</span><a href="#local-6989586621679082050"><span class="hs-identifier hs-var">h</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(w -&gt; m (a, w)) -&gt; WriterT w m a
forall w (m :: * -&gt; *) a. (w -&gt; m (a, w)) -&gt; WriterT w m a
</span><a href="Control.Monad.Trans.Writer.CPS.html#WriterT"><span class="hs-identifier hs-var">WriterT</span></a></span><span> </span><span class="annot"><span class="annottext">((w -&gt; m (a, w)) -&gt; WriterT w m a)
-&gt; (w -&gt; m (a, w)) -&gt; WriterT w m a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621679082049"><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679082049"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-282"></span><span>    </span><span class="annot"><span class="annottext">WriterT w m a -&gt; w -&gt; m (a, w)
forall w (m :: * -&gt; *) a. WriterT w m a -&gt; w -&gt; m (a, w)
</span><a href="Control.Monad.Trans.Writer.CPS.html#unWriterT"><span class="hs-identifier hs-var hs-var">unWriterT</span></a></span><span> </span><span class="annot"><span class="annottext">WriterT w m a
</span><a href="#local-6989586621679082051"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679082049"><span class="hs-identifier hs-var">w</span></a></span><span> </span><span class="annot"><span class="annottext">Catch e m (a, w)
</span><a href="#local-6989586621679082052"><span class="hs-operator hs-var">`catchE`</span></a></span><span> </span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621679082048"><span class="annot"><span class="annottext">e
</span><a href="#local-6989586621679082048"><span class="hs-identifier hs-var">e</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">WriterT w m a -&gt; w -&gt; m (a, w)
forall w (m :: * -&gt; *) a. WriterT w m a -&gt; w -&gt; m (a, w)
</span><a href="Control.Monad.Trans.Writer.CPS.html#unWriterT"><span class="hs-identifier hs-var hs-var">unWriterT</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">e -&gt; WriterT w m a
</span><a href="#local-6989586621679082050"><span class="hs-identifier hs-var">h</span></a></span><span> </span><span class="annot"><span class="annottext">e
</span><a href="#local-6989586621679082048"><span class="hs-identifier hs-var">e</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679082049"><span class="hs-identifier hs-var">w</span></a></span><span>
</span><span id="line-283"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Writer.CPS.html#liftCatch"><span class="hs-pragma hs-type">liftCatch</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-284"></span></pre></body></html>